@extends('layout.default')

@section('content')

  @include('layout.breadcrums')
	
  <div class="weui-cells weui-cells_form">
    <div class="weui-cell weui-cell_active weui-cell_access">
      <div class="weui-cell__bd">
        <p style="font-size: 80%;">图片尺寸比例为2:1，最大640*320</p>
      </div>
    </div>
   
    @foreach($swipers as $swiper)
    <div class="weui-cell weui-cell_active weui-cell_access">
      <div class="weui-cell__bd">
        <div class="weui-uploader">
          <div class="weui-uploader__bd">              
            <img src="{{$swiper->content}}" class="cover" style="width:97%;" />
            <input type="file" name="swiper[]" class="file" style="display: none;">
          </div>
        </div>
      </div>
    </div>
    @endforeach
   

    <div class="weui-btn-area weui-form__opr-area">
      <button class="weui-btn weui-btn_primary" id="btnSubmit">确定</button>
    </div>

  </div>

  


@stop

@section('javascript')
    <script src="//cdn.bootcss.com/jqueryui/1.12.1/jquery-ui.min.js"></script>
    <script type="text/javascript">
      $(function() {

        $('.cover').on('click',function(){
          $(this).next("input:file[name='swiper[]']").click();
        });

        $('.file').on('change',function(){
            $(this).prev('img').attr('src',URL.createObjectURL($(this)[0].files[0]));  
        });

      });
    </script>

@stop